function clock() {
  console.clear();

  now = new Date();
  h = now.getHours();
  m = now.getMinutes();
  s = now.getSeconds();

  if (h < 10) h = "0" + h;
  if (m < 10) m = "0" + m;
  if (s < 10) s = "0" + s;
  console.log(h + ":", m + ":", s);
  // console.log(now);
}
//每到一秒时，清空console,并显示当前时间。
//console.clear()一定要在进入clock函数时执行。这样才能保证时间持续显示。
var now = setInterval(clock, 1000);

const transformTime = () => {
  let time = new Date();
  let h = time.getHours();
  let m = time.getMinutes();
  if (h < 0) h = "0" + h;
  if (m < 0) m = "0" + m;
  return h + ":" + m;
};
